<template>
	<view>
		<view v-if="!members.length" class="none">暂无数据</view>
		<view class="list">
			<!-- <view class="list-item">
				<text class="">姓名</text>
				<text class="">出入</text>
				<text class="">体温</text>
				<text class="">时间</text>
			</view> -->
			<view @click="openDetail(item)" :class="`list-item ${item.tw=='是'?'':'bgred'}`" v-for="item in members" :key="item.id">
				<text class="">{{item.name}}</text>
				<text class="">{{item.inoutstr}}</text>
				<text class="">{{item.tw=='是'?'正常':'异常'}}</text>
				<text class="">{{item.createTime}}</text>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		components: {},
		data() {
			return {
				members: [],
				page: 1,
				rows: 20,
				hasmore: false
			};
		},
		onShow() {
			this.members = [];
			this.page = 1;
			this.loadData();
			this.hasmore = false;
		},
		onPullDownRefresh() {
			this.members = [];
			this.page = 1;
			this.hasmore = true;
			this.loadData();
		},
		onReachBottom() {
			if (this.hasmore) {
				this.page++;
				this.loadData();
			}
		},
		methods: {
			loadData() {
				uni.showLoading({
					title: "加载中..."
				});
				let that = this;
				this.$sendhttp('/Weixin/findRecord.dhtml', {
					page: this.page,
					rows: this.rows,
					oid: uni.getStorageSync("userinfo").oid
				}, function(data) {
					that.members = that.members.concat(data.objs);
					that.hasmore = data.hasNext;
					uni.hideLoading();
					uni.stopPullDownRefresh();
				});
			},
			//明细
			openDetail: function(item) {
				console.log(item);
				uni.navigateTo({
					url: "/pages/add-member/edit-member?p=" + encodeURIComponent(
						JSON.stringify(item)
					)
				});
			},
			//标签搜索
			tagQuery: function(e) {}
		}
	};
</script>

<style>
	.tag {
		display: flex;
		flex-direction: row;
		flex-wrap: wrap;
		padding: 10px 10px;
	}

	.none {
		text-align: center;
		color: #cccccc;
		line-height: 100px;
	}

	.bgred {
		background-color: red;
		color: white;
	}

	.list-item {
		display: flex;
		flex-direction: row;
		justify-content: space-around;
		border-bottom: 1px solid #bacebadd;
		margin: 10px;
		height: 31px;
	}
</style>
